<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
/*   Description  of this file
 *    Author king-of-war
 *    Last Modified 2009-5-6
 *    This class designed  for the *** operation
 */
 @session_start();
$root_path = '../';
include_once $root_path . 'admin/smarty_config.php';
include_once $root_path . 'admin/class/vote.class.php';
$vote = new vote($root_path);

/*
 *
 * check identify
 */
include_once $root_path.'admin/class/verify.class.php';
$a=new verify($root_path);
$a->identity_check(2);

/*
 * read the sort_id & contant
 */
$a = $vote->vote_read('', 1);
$max = count($a);
$votes = array ();
for ($i = 0; $i < $max; $i++) {
	$votes[$i]['id'] = $a[$i]->get_id();
	$votes[$i]['topic'] = $a[$i]->get_topic();
}
/*
 * vote_se add function
 */
$info = '投票选项添加';
if (isset ($_POST['submit'])) {
	//	$topic=$_POST['topic'];
	$vote_id=$_POST['vote_id'];
	$se_id=$_POST['se_id'];
	$contant=$_POST['contant'];
	$line=$vote->vote_add('',$se_id,$vote_id,$contant,3,1);
	if ($line) {
		$info = '添加成功';
	} else {
		$info = '添加失败';
	}
}
/*
 * set template
 */
$smarty->assign('votes', $votes);
$smarty->assign('info', $info);
$smarty->display("vote_add1.html");
?>
